import os
from langchain_community.chat_models import ChatZhipuAI 
from dotenv import load_dotenv, find_dotenv
from langchain_core.output_parsers.json import JsonOutputParser

_ = load_dotenv(find_dotenv())
model = os.environ.get('model')
if model is None:
    raise ValueError("model is not set in the .env file")

llm = ChatZhipuAI(model=model,
                  temperature=0.9,              
                )

response = llm.invoke("请以JSON格式列出世界最高的三座建筑的名称及其高度。")
jsonResult = JsonOutputParser()
result= jsonResult.invoke(response)
for item in result:
    print(item)
